﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="list.aspx.cs" Inherits="参保_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>用户列表</title>
        <LINK href="../Css/style.css" type="text/css" rel="stylesheet"/>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" PostBackUrl="~/参保/add.aspx">添加人员信息</asp:LinkButton><br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataKeyNames="personId" DataSourceID="SqlDataSource1"
            ForeColor="#333333" PageSize="20" EmptyDataText="无信息" OnDataBound="GridView1_DataBound">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" Wrap="False"  />
            <Columns>
                <asp:TemplateField HeaderText="操作" ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            Text="更新"></asp:LinkButton>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="取消"></asp:LinkButton>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#"~/参保/detail.aspx?personId=" + Eval("personId") + "&pageIndex="+GridView1.PageIndex%>'>详细</asp:HyperLink>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="编辑"></asp:LinkButton>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="删除" OnClientClick="return confirm('极危险的操作，会级联删除该身份证对应所有缴费信息，确认要删除吗？');"  OnCommand="LinkButton2_Command" CommandArgument='<%# Eval("personId") %>'></asp:LinkButton>
                    </ItemTemplate>
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="参保状态" SortExpression="cbzt">
                    <EditItemTemplate>
                        &nbsp;<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("cbzt") %>'>
                            <asp:ListItem>新参保</asp:ListItem>
                            <asp:ListItem>停保</asp:ListItem>
                            <asp:ListItem>转出</asp:ListItem>
                            <asp:ListItem>退休</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("cbzt") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="身份证号" SortExpression="personId">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("personId") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("personId") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="个人编号" SortExpression="insuranceId">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" ReadOnly="True" Text='<%# Bind("insuranceId") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("insuranceId") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>
                <asp:BoundField DataField="username" HeaderText="姓名" SortExpression="username">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="性别" SortExpression="sex">
                    <EditItemTemplate>
                        <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
                            SelectedValue='<%# Bind("sex") %>'>
                            <asp:ListItem>男</asp:ListItem>
                            <asp:ListItem>女</asp:ListItem>
                        </asp:RadioButtonList>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("sex") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>
                <asp:BoundField DataField="csrq" DataFormatString="{0:yyyy-MM-dd}" HeaderText="出生日期"
                    SortExpression="csrq">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="mz" HeaderText="民族" SortExpression="mz">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="whcd" HeaderText="文化程度" SortExpression="whcd">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="ygxs" HeaderText="用工形式" SortExpression="ygxs">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="grsf" HeaderText="个人身份" SortExpression="grsf">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="hkxz" HeaderText="户口形式" SortExpression="hkxz">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="gsdw" HeaderText="归属单位" SortExpression="gsdw">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="yzbm" HeaderText="邮政编码" SortExpression="yzbm">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="phone" HeaderText="联系电话" SortExpression="phone">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="hkdz" HeaderText="户口地址" SortExpression="hkdz">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="txdz" HeaderText="通讯地址" SortExpression="txdz">
                    <HeaderStyle Wrap="False" />
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <EmptyDataTemplate>
                没有数据
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Wrap="False"  />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:insurance_dbConnectionString %>"
            DeleteCommand="DELETE FROM [缴费人员表] WHERE [personId] = @personId" InsertCommand="INSERT INTO [缴费人员表] ([personId], [insuranceId], [username], [sex], [csrq], [mz], [whcd], [ygxs], [grsf], [hkxz], [gsdw], [yzbm], [phone], [hkdz], [txdz], [cbzt], [del]) VALUES (@personId, @insuranceId, @username, @sex, @csrq, @mz, @whcd, @ygxs, @grsf, @hkxz, @gsdw, @yzbm, @phone, @hkdz, @txdz, @cbzt, @del)"
            SelectCommand="SELECT * FROM [缴费人员表]" UpdateCommand="UPDATE [缴费人员表] SET [insuranceId] = @insuranceId, [username] = @username, [sex] = @sex, [csrq] = @csrq, [mz] = @mz, [whcd] = @whcd, [ygxs] = @ygxs, [grsf] = @grsf, [hkxz] = @hkxz, [gsdw] = @gsdw, [yzbm] = @yzbm, [phone] = @phone, [hkdz] = @hkdz, [txdz] = @txdz, [cbzt] = @cbzt, [del] = @del WHERE [personId] = @personId" OnInit="SqlDataSource1_Init">
            <DeleteParameters>
                <asp:Parameter Name="personId" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="insuranceId" Type="String" />
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="sex" Type="String" />
                <asp:Parameter DbType="Date" Name="csrq" />
                <asp:Parameter Name="mz" Type="String" />
                <asp:Parameter Name="whcd" Type="String" />
                <asp:Parameter Name="ygxs" Type="String" />
                <asp:Parameter Name="grsf" Type="String" />
                <asp:Parameter Name="hkxz" Type="String" />
                <asp:Parameter Name="gsdw" Type="String" />
                <asp:Parameter Name="yzbm" Type="String" />
                <asp:Parameter Name="phone" Type="String" />
                <asp:Parameter Name="hkdz" Type="String" />
                <asp:Parameter Name="txdz" Type="String" />
                <asp:Parameter Name="cbzt" Type="String" />
                <asp:Parameter Name="del" Type="Int32" />
                <asp:Parameter Name="personId" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="personId" Type="String" />
                <asp:Parameter Name="insuranceId" Type="String" />
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="sex" Type="String" />
                <asp:Parameter DbType="Date" Name="csrq" />
                <asp:Parameter Name="mz" Type="String" />
                <asp:Parameter Name="whcd" Type="String" />
                <asp:Parameter Name="ygxs" Type="String" />
                <asp:Parameter Name="grsf" Type="String" />
                <asp:Parameter Name="hkxz" Type="String" />
                <asp:Parameter Name="gsdw" Type="String" />
                <asp:Parameter Name="yzbm" Type="String" />
                <asp:Parameter Name="phone" Type="String" />
                <asp:Parameter Name="hkdz" Type="String" />
                <asp:Parameter Name="txdz" Type="String" />
                <asp:Parameter Name="cbzt" Type="String" />
                <asp:Parameter Name="del" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
